package com.campusbackend.mapper;

import com.campusbackend.entity.Skills;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 技能特长字典表 Mapper 接口
 * </p>
 *
 * @author yezi
 * @since 2025-07-24
 */
@Mapper
public interface SkillsMapper extends BaseMapper<Skills> {

    /**
     * 获取所有可用的技能列表
     * @return 技能列表
     */
    @Select("SELECT * FROM skills WHERE status = 1 ORDER BY skill_category, skill_name")
    List<Skills> getAllActiveSkills();

    /**
     * 根据技能名称批量查找技能ID
     * @param skillNames 技能名称列表
     * @return 技能ID列表
     */
    @Select("<script>" +
            "SELECT id FROM skills WHERE status = 1 AND skill_name IN " +
            "<foreach collection='skillNames' item='skillName' open='(' separator=',' close=')'>" +
            "#{skillName}" +
            "</foreach>" +
            "</script>")
    List<Long> getSkillIdsByNames(@Param("skillNames") List<String> skillNames);
}
